import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class TestA {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        List<String> content = new ArrayList<String>();
        content.add(br.readLine());
        content.add(br.readLine());
        content.add(br.readLine());
        content.add(br.readLine());
//        String one = br.readLine();
//        String two = br.readLine();
//        String three = br.readLine();
//        String four = br.readLine();
        String nums = br.readLine();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < nums.length(); i++) {
            int locate = Integer.parseInt(String.valueOf(nums.charAt(i)))-1;
            String line = content.get(i);
            sb.append(line.charAt(locate));
        }
        System.out.println(sb);
    }
}
